package cn.sciento.transfer.infra.init;

import cn.sciento.transfer.app.service.ProducerConfigService;
import cn.sciento.transfer.infra.properties.StongTransferProperties;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RedisValueInit implements InitializingBean {
  @Autowired
  private StongTransferProperties stongTransferProperties;
  
  @Autowired
  private ProducerConfigService producerConfigService;
  
  @Override
  public void afterPropertiesSet() throws Exception {
    if (this.stongTransferProperties.getInitCache() == null || !this.stongTransferProperties.getInitCache()) {
      return;
    }
    this.producerConfigService.initConfigsToRedis();
  }
}
